import React,{ Component } from 'react';
import './productDefault.scss';
import '../../index/index.scss';
import { goodsDetail } from 'api/user.js';
export default class ProductDefault extends Component{
	constructor (props) {
		super(props)
		this.state={
			productDefaultList: {}
		}
	}
	goBack () { //返回上一级
		this.props.history.goBack()
	}
	componentDidMount(){
		document.title = '产品详情'
		goodsDetail({
			goods_id: this.props.location.state.goods_id
		}).then(res => {
			this.setState({
				productDefaultList: res.data
			})
		})
	}
	render(){
		return(
			<div className="productDefault">
				{/*<div className="title">
					<div onClick={this.goBack.bind(this)}><i className="glyphicon glyphicon-left"></i></div>
					<div>产品详情</div>
					<div><i className="glyphicon glyphicon-share"></i></div>
				</div>*/}
				<div className="productCard_content">
					<div className="productCard_content_title">
						<img src={this.state.productDefaultList.goods_image} className="productCard_img" alt="lalal"/>
						<p className="productCard_header">{this.state.productDefaultList.goods_name}</p>
						{
							this.state.productDefaultList.is_price === 1 ?
							<span className="productCard_pic">￥{this.state.productDefaultList.goods_price}</span>
							: ''
						}
						
					</div>
					<p className="productDefault_line"></p>
					<div className="productDefault_content_text">
						<p>商品详情</p>
						<div dangerouslySetInnerHTML={{__html: this.state.productDefaultList.remark}}></div>
					</div>
				</div>
			</div>
		)
	}
}